package com.lxw.weather.activity;

import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.lxw.weather.R;
import com.lxw.weather.model.LifeIndex;

public class LifeIndexActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_life_index);
        
        // 获取生活指数数据
        LifeIndex lifeIndex = getIntent().getParcelableExtra("lifeIndexData");
        
        // 更新UI显示
        if (lifeIndex != null) {
            ((TextView) findViewById(R.id.dressIndex)).setText(
                lifeIndex.getDressIndex().getState() + ": " + lifeIndex.getDressIndex().getReply());
            
            ((TextView) findViewById(R.id.uvIndex)).setText(
                lifeIndex.getUvIndex().getState() + ": " + lifeIndex.getUvIndex().getReply());
            
            // 添加其他指数的UI更新代码
            ((TextView) findViewById(R.id.coldIndex)).setText(
                lifeIndex.getColdIndex().getState() + ": " + lifeIndex.getColdIndex().getReply());
                
            ((TextView) findViewById(R.id.carWashIndex)).setText(
                lifeIndex.getCarWashIndex().getState() + ": " + lifeIndex.getCarWashIndex().getReply());
                
            ((TextView) findViewById(R.id.sportIndex)).setText(
                lifeIndex.getSportIndex().getState() + ": " + lifeIndex.getSportIndex().getReply());
                
            // 添加过敏指数空检查
            if (lifeIndex.getAllergyIndex() != null) {
                ((TextView) findViewById(R.id.allergyIndex)).setText(
                    lifeIndex.getAllergyIndex().getState() + ": " + lifeIndex.getAllergyIndex().getReply());
            } else {
                ((TextView) findViewById(R.id.allergyIndex)).setText("暂无数据");
            }
        }
    }
}